<!--
  @Descripttion：海报详情
  @Author：zqy
  @Date：2020-07-28 10:57:14
  @Last Modified by：zqy
  @Last Modified time：2020-07-28 10:57:14
-->
<template>
  <div>
    <div class="bread-box">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item class="btn-green" @click.native="goBack">Demo列表</el-breadcrumb-item>
        <el-breadcrumb-item>详情</el-breadcrumb-item>
      </el-breadcrumb>
      <div>
        <el-button size="mini" type="primary">保存</el-button>
        <el-button size="mini" @click.native="goBack">返回</el-button>
      </div>
    </div>

    <div class="mt20">
      <el-form size="mini" inline label-width="100px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="职务编码:">
              {{ detailData.positionCode }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="职务名称:">
              {{ detailData.positionName }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="创建人:">
              {{ detailData.createBy }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="创建时间:">
              {{ detailData.createTime | filterTime }}
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="职务描述:">
              {{ detailData.positionDesc }}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="mt20">
      <div class="qup-title-box"><span class="border" /><span>表格数据</span></div>
      <div class="table-list-box">
        <el-table
          style="width: 100%"
          :data="productList"
          header-row-class-name="table-list-header"
          highlight-current-row
          border
        >
          <el-table-column label="序号" type="index" />
          <el-table-column prop="productCode" label="产品编码" min-width="150" />
          <el-table-column prop="productDesc" label="产品名称" min-width="200" />
          <el-table-column label="数量" min-width="60">
            <template v-slot="{row}">
              {{ row.quantity || 0 }}
            </template>
          </el-table-column>
          <el-table-column label="关闭量" min-width="60">
            <template v-slot="{row}">
              {{ row.closeNum || 0 }}
            </template>
          </el-table-column>
          <el-table-column label="排工量" min-width="60">
            <template v-slot="{row}">
              {{ row.scheduleNum || 0 }}
            </template>
          </el-table-column>
          <el-table-column label="出库量" min-width="60">
            <template v-slot="{row}">
              {{ row.outStockNum || 0 }}
            </template>
          </el-table-column>
          <el-table-column label="完工量" min-width="60">
            <template v-slot="{row}">
              {{ row.completionNum || 0 }}
            </template>
          </el-table-column>
          <el-table-column prop="remark" label="备注" min-width="150" />
        </el-table>
      </div>
    </div>
    <div class="mt20">
      <div class="qup-title-box"><span class="border" /><span>分组标题</span></div>
      <el-form size="mini" inline label-width="100px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="职务编码:">
              {{ detailData.positionCode }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="职务名称:">
              {{ detailData.positionName }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="创建人:">
              {{ detailData.createBy }}
            </el-form-item>
          </el-col>
          <el-col v-if="pictureList && pictureList.length" :span="24">
            <el-form-item label="凭证:" class="note-item">
              <div class="voucher-list">
                <div v-for="(item,index) in pictureList" :key="index" class="voucher">
                  <el-image
                    style="width: 120px; height: 120px"
                    :src="item"
                    :preview-src-list="pictureList"
                  />
                </div>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
  </div>
</template>

<script>
import { parseTime } from '@/utils'
export default {
  name: 'DetailPage',
  filters: {
    filterTime(val) {
      return parseTime(val) || ''
    }
  },
  props: {
    pageShow: {
      type: Boolean,
      default: false,
      required: true
    },
    detailData: {
      type: [String, Object],
      default: ''
    }
  },
  data() {
    return {
      productList: [
        {
          productCode: 'SPUC00000091',
          productDesc: '床-部分SKU参与秒杀活动的测试',
          quantity: 2,
          closeNum: 1,
          scheduleNum: 2,
          outStockNum: 0,
          completionNum: 1,
          remark: '测试数据'
        }
      ],
      pictureList: [
        'https://testimg.quanyou.com.cn/group1/M00/00/E8/rB8Mk19leUeAENytAApIOcZ78Zw513.JPG',
        'https://testimg.quanyou.com.cn/group1/M00/00/F4/rB8Mk198AyuAD3SxAA1BKG7d-8A396.png',
        'https://testimg.quanyou.com.cn/group1/M00/00/D9/rB8Mkl9R8zGAHAaIAAJiR9cXsKg193.JPG'
      ]
    }
  },
  computed: {
    nowPageShow: {
      get() {
        return this.pageShow
      },
      set(val) {
        this.$emit('update:pageShow', val)
      }
    }
  },
  created() {

  },

  methods: {
    goBack() {
      this.nowPageShow = false
    }
  }
}
</script>
<style lang='scss' scoped>
  /deep/ .el-breadcrumb__inner{
    color: $qup-color-primary;
  }
  .mt20{
    margin-top: 20px;
  }
  .voucher-list{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    .voucher{
      width: 120px;
      height: 120px;
      margin:0 5px 5px 0;
      overflow: hidden;
      img{
        width: 120px;
        height: 120px;
        object-fit: cover;
      }
    }
  }
</style>
